//
//  GRJMacros.h
//  GRJTolCayFrwk
//
//  Created by apple on 2017/3/1.
//  Copyright © 2017年 Global Barter. All rights reserved.
//

#ifndef ____Marcos_h
#define ____Marcos_h

/*********************屏幕适配*********************************/
#define kScreenWidth          [[UIScreen mainScreen] bounds].size.width
#define kScreenHeight         [[UIScreen mainScreen] bounds].size.height
#define kScreen_Frame       (CGRectMake(0, 0 ,kScreenWidth,kScreenHeight))


/* SERVER */
//#define APP_SERVER @"http://jiankang.net"
#define APP_SERVER @"http://139.196.13.183/api.php"
#define APP_URL @"http://139.196.13.183"
#define API_URL(_URL)  [NSURL URLWithString:[NSString stringWithFormat:@"%@/api.php?%@",APP_SERVER,_URL]]
#define WEB_URL(_URL)  [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",APP_SERVER,_URL]]

// 设备型号
#define DEVICE @"iphone"

//获取系统版本
#define IOS6 ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0) ? YES : NO
#define IOS7_OR_LATER  ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) ? YES : NO
#define IOS8_OR_LATER  [[[UIDevice currentDevice] systemVersion] compare:@"8.0"] != NSOrderedAscending

//判断是否是Iphone5
//#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6P (kScreenHeight== 736)
#define iPhone6 (kScreenHeight == 667)
#define iPhone5 (kScreenHeight == 568)
#define iPhone4 (kScreenHeight == 480)


//定义宽高和尺寸
#define SCREEN_WIDTH  [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#define SCREEN_SIZE [UIScreen mainScreen].bounds.size

//定义字体大小(正常)
#define FONT_11 [UIFont systemFontOfSize:11.0f]
#define FONT_14 [UIFont systemFontOfSize:14.0f]
#define FONT_15 [UIFont systemFontOfSize:15.0f]
#define FONT_16 [UIFont systemFontOfSize:16.0f]
#define FONT_18 [UIFont systemFontOfSize:18.0f]

//定义字体大小(加粗)
#define FONT_B_11 [UIFont boldSystemFontOfSize:11.0f]
#define FONT_B_12 [UIFont boldSystemFontOfSize:12.0f]
#define FONT_B_13 [UIFont boldSystemFontOfSize:13.0f]
#define FONT_B_14 [UIFont boldSystemFontOfSize:14.0f]
#define FONT_B_15 [UIFont boldSystemFontOfSize:15.0f]
#define FONT_B_16 [UIFont boldSystemFontOfSize:16.0f]
#define FONT_B_17 [UIFont boldSystemFontOfSize:17.0f]
#define FONT_B_18 [UIFont boldSystemFontOfSize:18.0f]
#define FONT_B_19 [UIFont boldSystemFontOfSize:19.0f]

#pragma mark - font

//普通字体
#define UIFontBigX [UIFont systemFontOfSize:18]
#define UIFontBig [UIFont systemFontOfSize:16]
#define UIFontDefault [UIFont systemFontOfSize:14]
#define UIFontSmall [UIFont systemFontOfSize:12]
#define UIFontSmallX [UIFont systemFontOfSize:10]
#define UIFontSmallXX [UIFont systemFontOfSize:8]

//粗体
#define UIFontBigXBold [UIFont boldSystemFontOfSize:18]
#define UIFontBigBold [UIFont boldSystemFontOfSize:16]
#define UIFontDefaultBold [UIFont boldSystemFontOfSize:14]
#define UIFontSmallBold [UIFont boldSystemFontOfSize:12]
#define UIFontSmallXBold [UIFont boldSystemFontOfSize:10]

#pragma mark - color

/* 系统控件的默认高度 */
#define StatusBarHeight   (20.f)
#define NavBarHeight      (44.f)
#define BottomBarHeight   (49.f)
#define TopBarHeight      (IOS7_OR_LATER ? StatusBarHeight + NavBarHeight : NavBarHeight)
#define ContentHeight     APP_HEIGHT - TopBarHeight - BottomBarHeight
#define TableViewCellDefaultHeight (44.f)
#define KeyboardHeightEnglish  (216.f)
#define KeyboardHeightChinese  (252.f)

//主色调
#define UIColorBlue UIColorFromRGB(0x1f9fcf)
#define UIColorBlueLight UIColorFromRGB(0x41c4f6)
#define UIColorBlueDark UIColorFromRGB(0x2f7faf)

//字体颜色
#define UIColorFontDefault UIColorFromRGB(0x515567)
#define UIColorFontGray UIColorFromRGB(0x8f8f8f)
#define UIColorFontBlue UIColorFromRGB(0x3f4f7f)
#define UIColorFontBlueLight UIColorFromRGB(0x1f9fcf)
#define UIColorFontRed UIColorFromRGB(0xaf4f3f)
#define UIColorFontGreen UIColorFromRGB(0x3fcf5f)

//背景色
#define UIColorBackground UIColorFromRGB(0xefefef)
#define UIColorBackgroundLight UIColorFromRGB(0xf7f7f7)
#define UIColorBackgroundDark UIColorFromRGB(0xcfcfcf)

#define UIColorBackgroundBlue UIColorFromRGB(0x1f9fcf)
#define UIColorBackgroundBlueLight UIColorFromRGB(0x41c4f6)
#define UIColorBackgroundBlueDark UIColorFromRGB(0x2f7faf)

#define UIColorBackgroundInfo UIColorFromRGB(0xefefef)
#define UIColorBackgroundWarn UIColorFromRGB(0xffefc7)
#define UIColorBackgroundError UIColorFromRGB(0xffe7e7)

//边框色
#define UIColorBorder UIColorFromRGB(0xcfcfcf)
#define UIColorBorderLight UIColorFromRGB(0xefefef)
#define UIColorBorderDark UIColorFromRGB(0xafafaf)

#define RGBACOLOR(r,g,b,a)       [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
//定义cell中组的高度
#define JHGroupHeight 25

// 获得RGB颜色
#define JHColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0];

// 统一日志输出
#ifdef DEBUG  // 调试阶段
#define PCLog(...) NSLog(__VA_ARGS__)
#else // 发布阶段
#define PCLog(...)
#endif

// 通知
#define JHNotificationCenter [NSNotificationCenter defaultCenter]

// 识别真机和模拟器
#if TARGET_IPHONE_SIMULATOR
#define SIMULATOR 1
#elif TARGET_OS_IPHONE
#define SIMULATOR 0
#endif

// ios7导航栏高度
#define IOS7NavHeight  64

// 上传图片的大小
#define IMAGEXY 600

// 全局的appdelegate
#define HBDelegate  ((AppDelegate *) [[UIApplication sharedApplication] delegate])

// 判断是否为物流商
#define LOGISTICSLEVEL  ((NSString *) [[NSUserDefaults standardUserDefaults] objectForKey:IS_LOGISTICSLEVEL])

// 颜色
#define PCColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]

// 随机色
#define PCRandomColor PCColor(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))

// 全局背景色
#define PCGlobalBg PCColor(239, 239, 239)

// cell的计算参数
// cell之间的间距
#define PCStatusCellMargin 10
// cell的内边距
#define PCStatusCellInset 10

//PNG JPG 图片路径
#define PATH_PNG(NAME)      [[NSBundle mainBundle] pathForResource:[NSString stringWithUTF8String:NAME] ofType:@"png"]
#define PATH_JPG(NAME)      [[NSBundle mainBundle] pathForResource:[NSString stringWithUTF8String:NAME] ofType:@"jpg"]
#define PATH(NAME,EXT)      [[NSBundle mainBundle] pathForResource:(NAME) ofType:(EXT)]

//加载图片
#define IMAGE_PNG(NAME)     [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:@"png"]]
#define IMAGE_JPG(NAME)     [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:@"jpg"]]
#define IMAGE(NAME,EXT)     [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:(EXT)]]
#define IMAGE_NAMED(NAME)   [UIImage imageNamed:NAME]

// 通知
#define PCNotice [NSNotificationCenter defaultCenter]
#define APP_DISPLAY_NAME @"谷瑞杰"

#endif

